feat(datasets): add update subcommand to rename label or table_name#65
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Review
Blocking Issues
src/datasets.rs:527:println!for "Dataset updated" corrupts stdout in-o json/-o yamlmodes — any pipe likehotdata datasets update ... -o json | jqwill fail because the human-readable line is not valid JSON.
Action Required
Change line 527 from println! to eprintln! so the status message goes to stderr and stdout stays clean for structured output. This matches what you described in your reply to thread #3157593891 — the final commit appears to have regressed it back to println!.
| let d: UpdateResponse = api.put(&format!("/datasets/{dataset_id}"), &body); | ||
|
|
||
| use crossterm::style::Stylize; | ||
| println!("{}", "Dataset updated".green()); |
There was a problem hiding this comment.
blocking: println! here emits "Dataset updated" to stdout before the JSON/YAML payload, which breaks piping in structured output modes. Running hotdata datasets update ... -o json | jq will fail because the first line is not valid JSON.
Change to eprintln! to keep stdout clean — this is what you described as intentional in thread #3157593891, but the final commit (fb8af95) regressed it back to println!.
| println!("{}", "Dataset updated".green()); | |
| eprintln!("{}", "Dataset updated".green()); |
Reverts fb8af95. The suggestion changed eprintln! to println!, which puts the human prelude on stdout and breaks `-o json` / `-o yaml` piping (e.g. `... -o json | jq` fails with a parse error because the status line precedes the JSON).
Adds
hotdata datasets update <ID> [--label X] [--table-name Y]so users can rename a dataset without recreating it. Closes the gap motivated by hotdata-dev/runtimedb#371 (auto-generated table names that diverged from labels).Notes for reviewers
src/api.rshunks beyond the newput()method are unrelated rustfmt cleanup that got picked up automatically when the file was touched. The only behavior change in that file is the addedput()helper.--pinned-version/--unpinflags were intentionally scoped out — tracked in Add --pinned-version / --unpin to datasets update #66.